# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Benjamin Denhartog <ben@sudoforge.com>
# Contributor: Andreas 'Segaja' Schleifer <archlinux at segaja dot de>

pkgname=terragrunt
pkgver=0.53.0
pkgrel=1
pkgdesc='Thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules'
url='https://github.com/gruntwork-io/terragrunt'
arch=('loong64' 'x86_64')
makedepends=('git' 'go')
depends=('glibc' 'terraform')
license=('MIT')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('a8279dc1edc03954c0dbbf986bc5063845fa8a40a3da7b957d3b8bfbac8f5f55')
b2sums=('0f72e3235503201f0961fbbc5f87639b3f20dbc5fa25262138d2de796229213eb5bd99e53081de7bceedd9c0e9d872a39c5473e27ae3134e2a85e125bc47029f')
options=('!lto')

build() {
  cd ${pkgname}-${pkgver}
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -ldflags=-linkmode=external -trimpath -mod=readonly -modcacherw"
  go build -v \
    -ldflags "-linkmode=external -extldflags '${LDFLAGS}' -X main.VERSION=${pkgver}" \
    .
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 ${pkgname} -t "${pkgdir}/usr/bin"
  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set ts=2 sw=2 et:
